package io.zcoder.innoway.widgets;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.EditText;

import io.zcoder.innoway.R;
import io.zcoder.innoway.commons.Constants;


public class EditTextCustom extends EditText {

    public EditTextCustom(Context context) {
        super(context);
    }

    public EditTextCustom(Context context, AttributeSet attrs) {
        super(context, attrs);
        TypedArray arr = context.obtainStyledAttributes(attrs, R.styleable.FontCustom);
        int font = arr.getInt(R.styleable.FontCustom_font, -1);
        if (font >= 0) {
            Typeface typeFace =
                    Typeface.createFromAsset(context.getAssets(), Constants.FONTS[font]);
            setTypeface(typeFace);
        }
    }

    public boolean isEmpty() {
        return getText().toString().isEmpty();
    }

    public String getString(){
        return getText().toString();
    }
}
